//
//  ImageLoader.h
//  FunnyOfTheDay
//
//  Created by Giorgi Gioshvili on 12/3/10.
//  Copyright 2010 FSS. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <Foundation/NSError.h>

@interface ImageLoader : NSObject {

    NSString * url;
    bool isLoadingData;
    NSError * lastError;
    long long expectedContentLength;
    UIProgressView * progressBar;    
    NSMutableData * receivedData;
    
}

@property (nonatomic, retain) NSString * url;
@property (nonatomic, assign) bool isLoadingData;
@property (nonatomic, retain) NSError * lastError;
@property (nonatomic, retain) UIProgressView * progressBar;
@property (nonatomic, assign) long long expectedContentLength;
@property (nonatomic, retain) NSData * receivedData;

- (NSError *) loadImage:(NSString*)url withProgressBar:(UIProgressView*)progressBar;
- (void)_startLoadingImage;
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response;
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data;
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error;
- (void)connectionDidFinishLoading:(NSURLConnection *)connection;
@end
